Optimal. Leaf size=87 \[ \frac {7 a^2 x}{8}+\frac {2 a^2 \sin (c+d x)}{d}+\frac {7 a^2 \cos (c+d x) \sin (c+d x)}{8 d}+\frac {a^2 \cos ^3(c+d x) \sin (c+d x)}{4 d}-\frac {2 a^2 \sin ^3(c+d x)}{3 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.07, antiderivative size = 87, normalized size of antiderivative = 1.00, number of steps
used = 9, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {2836, 2715, 8,
2713} \begin {gather*} -\frac {2 a^2 \sin ^3(c+d x)}{3 d}+\frac {2 a^2 \sin (c+d x)}{d}+\frac {a^2 \sin (c+d x) \cos ^3(c+d x)}{4 d}+\frac {7 a^2 \sin (c+d x) \cos (c+d x)}{8 d}+\frac {7 a^2 x}{8} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 2713
Rule 2715
Rule 2836
Rubi steps
\begin {align*} \int \cos ^2(c+d x) (a+a \cos (c+d x))^2 \, dx &=\int \left (a^2 \cos ^2(c+d x)+2 a^2 \cos ^3(c+d x)+a^2 \cos ^4(c+d x)\right ) \, dx\\ &=a^2 \int \cos ^2(c+d x) \, dx+a^2 \int \cos ^4(c+d x) \, dx+\left (2 a^2\right ) \int \cos ^3(c+d x) \, dx\\ &=\frac {a^2 \cos (c+d x) \sin (c+d x)}{2 d}+\frac {a^2 \cos ^3(c+d x) \sin (c+d x)}{4 d}+\frac {1}{2} a^2 \int 1 \, dx+\frac {1}{4} \left (3 a^2\right ) \int \cos ^2(c+d x) \, dx-\frac {\left (2 a^2\right ) \text {Subst}\left (\int \left (1-x^2\right ) \, dx,x,-\sin (c+d x)\right )}{d}\\ &=\frac {a^2 x}{2}+\frac {2 a^2 \sin (c+d x)}{d}+\frac {7 a^2 \cos (c+d x) \sin (c+d x)}{8 d}+\frac {a^2 \cos ^3(c+d x) \sin (c+d x)}{4 d}-\frac {2 a^2 \sin ^3(c+d x)}{3 d}+\frac {1}{8} \left (3 a^2\right ) \int 1 \, dx\\ &=\frac {7 a^2 x}{8}+\frac {2 a^2 \sin (c+d x)}{d}+\frac {7 a^2 \cos (c+d x) \sin (c+d x)}{8 d}+\frac {a^2 \cos ^3(c+d x) \sin (c+d x)}{4 d}-\frac {2 a^2 \sin ^3(c+d x)}{3 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.14, size = 53, normalized size = 0.61 \begin {gather*} \frac {a^2 (84 d x+144 \sin (c+d x)+48 \sin (2 (c+d x))+16 \sin (3 (c+d x))+3 \sin (4 (c+d x)))}{96 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.10, size = 90, normalized size = 1.03
method | result | size |
risch | \(\frac {7 a^{2} x}{8}+\frac {3 a^{2} \sin \left (d x +c \right )}{2 d}+\frac {a^{2} \sin \left (4 d x +4 c \right )}{32 d}+\frac {a^{2} \sin \left (3 d x +3 c \right )}{6 d}+\frac {a^{2} \sin \left (2 d x +2 c \right )}{2 d}\) | \(73\) |
derivativedivides | \(\frac {a^{2} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+\frac {2 a^{2} \left (\cos ^{2}\left (d x +c \right )+2\right ) \sin \left (d x +c \right )}{3}+a^{2} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(90\) |
default | \(\frac {a^{2} \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+\frac {2 a^{2} \left (\cos ^{2}\left (d x +c \right )+2\right ) \sin \left (d x +c \right )}{3}+a^{2} \left (\frac {\sin \left (d x +c \right ) \cos \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(90\) |
norman | \(\frac {\frac {7 a^{2} x}{8}+\frac {25 a^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}+\frac {83 a^{2} \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}+\frac {77 a^{2} \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{12 d}+\frac {7 a^{2} \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}+\frac {7 a^{2} x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}+\frac {21 a^{2} x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4}+\frac {7 a^{2} x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}+\frac {7 a^{2} x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{4}}\) | \(166\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.28, size = 83, normalized size = 0.95 \begin {gather*} -\frac {64 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} a^{2} - 3 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2} - 24 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} a^{2}}{96 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.40, size = 63, normalized size = 0.72 \begin {gather*} \frac {21 \, a^{2} d x + {\left (6 \, a^{2} \cos \left (d x + c\right )^{3} + 16 \, a^{2} \cos \left (d x + c\right )^{2} + 21 \, a^{2} \cos \left (d x + c\right ) + 32 \, a^{2}\right )} \sin \left (d x + c\right )}{24 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 211 vs.
\(2 (82) = 164\).
time = 0.20, size = 211, normalized size = 2.43 \begin {gather*} \begin {cases} \frac {3 a^{2} x \sin ^{4}{\left (c + d x \right )}}{8} + \frac {3 a^{2} x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} + \frac {a^{2} x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {3 a^{2} x \cos ^{4}{\left (c + d x \right )}}{8} + \frac {a^{2} x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {3 a^{2} \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{8 d} + \frac {4 a^{2} \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {5 a^{2} \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{8 d} + \frac {2 a^{2} \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {a^{2} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (a \cos {\left (c \right )} + a\right )^{2} \cos ^{2}{\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.46, size = 72, normalized size = 0.83 \begin {gather*} \frac {7}{8} \, a^{2} x + \frac {a^{2} \sin \left (4 \, d x + 4 \, c\right )}{32 \, d} + \frac {a^{2} \sin \left (3 \, d x + 3 \, c\right )}{6 \, d} + \frac {a^{2} \sin \left (2 \, d x + 2 \, c\right )}{2 \, d} + \frac {3 \, a^{2} \sin \left (d x + c\right )}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 3.50, size = 89, normalized size = 1.02 \begin {gather*} \frac {7\,a^2\,x}{8}+\frac {\frac {7\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7}{4}+\frac {77\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5}{12}+\frac {83\,a^2\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3}{12}+\frac {25\,a^2\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{4}}{d\,{\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}^4} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________